package net.zigin.nhi.could.waste.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import net.zigin.nhi.could.waste.service.StatisticService;
import net.zigin.nhi.could.waste.vo.JsonForResult;
import net.zigin.nhi.could.waste.vo.WarnBaseVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Map;

@Api(tags = "态势")
@RestController
@RequestMapping("/statistic")
public class StatisticController {

    @Autowired
    private StatisticService statisticService;

    @GetMapping("/hospitalStatisticInfo")
    @ApiOperation("医院态势详情")
    public JsonForResult<Map<String, Map<String,Object>>> hospitalInfo(String hospitalBaseId){
        Map<String, Map<String, Object>> result = statisticService.hospitalStatisticInfo(hospitalBaseId);
        return JsonForResult.<Map<String, Map<String, Object>>>builder().data(result).success(true).build();
    }

    @GetMapping("/warnList")
    @ApiOperation("预警列表")
    public JsonForResult<List<WarnBaseVo>> warnList(){
        List<WarnBaseVo> warnBaseVos = statisticService.warnList();
        return JsonForResult.<List<WarnBaseVo>>builder().data(warnBaseVos).success(true).build();
    }

    @GetMapping("/wasteCollectTrend")
    @ApiOperation("回收趋势")
    @ApiImplicitParam(name = "model", value = "模式  1 年 0 月", required = true, dataType = "Integer")
    public JsonForResult<Map<String,Object>> wasteCollectTrend(Integer model){
        Map<String, Object> result = statisticService.wasteCollectTrend(model);
        return JsonForResult.<Map<String, Object>>builder().data(result).success(true).build();
    }

    @GetMapping("/topHospitalOrDepart")
    @ApiOperation("医院科室收集排名")
    @ApiImplicitParam(name = "model", value = "模式 1 日 0 月", required = true, dataType = "Integer")
    public JsonForResult<Map<String,Object>> topHospitalOrDepart(Integer model){
        Map<String, Object> result = statisticService.topHospitalOrDepart(model);
        return JsonForResult.<Map<String, Object>>builder().data(result).success(true).build();
    }

    @GetMapping("/statistic")
    @ApiOperation("总态势")
    public JsonForResult<Map<String, Map<String, Object>>> statistic(){
        Map<String, Map<String, Object>> statistic = statisticService.statistic();
        return JsonForResult.<Map<String, Map<String, Object>>>builder().data(statistic).success(true).build();
    }

}
